<extend name="Base/common"/>
<block name="head_css">
<link href="__PUBLIC__/Green/css/usercenter.css" rel='stylesheet' type='text/css' />
<link href="__PUBLIC__/css/awesome-bootstrap-checkbox.css" rel="stylesheet">
</block>
<block name="body">
    <div class="insurance">
        <div class="width1000">
            <div class="step_info">
                <div class="write_info">录入保单信息</div>
                <div class="get_price">获取精确报价</div>
                <div class="cash_money on">支付保单</div>
                <div style="clear:both"></div>
            </div>
            <div class="ins_tab">
                <a href="javascript:void(0);" class="f_l ins_tab_li">定制我的车险</a>
            </div>
    <div class="confirm_order width1000">
        <div class="confirm_detail clearfix" style="  margin-top: 2em;">
            <div class="col-sm-2">
              车牌号码：{$c_lcn_no}
            </div>
            <div class="col-sm-5">
            订单号：{$calc_result['BASE']['C_ORDER_NO']}
            </div>
            <div class="col-sm-2">
             下单时间：{$order_date}
            </div>
            <div class="col-sm-2 f_r confirm_d_money">
             ￥{$calc_result['BASE']['N_REAL_PRM']+$calc_result['BASE']['N_TRAFF_REAL_PRM']+$calc_result['BASE']['N_TAX_REAL_PRM']}元
            </div>
            <div class="col-sm-1">
             <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
                详情
            </button>
            </div>
        </div>
         <div class="collapse" id="collapseExample">
            <div style="border: 1px #ddd solid;">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>
                                承保险种
                            </th>
                            <th class="policy_money">
                                保险金额/赔偿限额(元)
                            </th>
                            <th class="policy_money">
                                折前保费
                            </th>
                            <th class="policy_money">
                                应缴保费(元)
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="calc_result['KIND_LIST']['KIND']" id="item">
                            <tr>
                                <td class="policy_msg">
                                    <p>{$item.C_KIND_NAME}</p>
                                </td>
                                <td class="policy_money">
                                    <p><if condition="$item['N_AMT'] eq 0">&nbsp;<else />{$item.N_AMT}</if></p>
                                </td>
                                <td class="policy_money">
                                    <p>￥{$item.N_BEN_PRM}</p>
                               </td>
                                <td class="policy_money">
                                    <p>￥{$item.N_PRM}</p>
                                </td>
                            </tr>
                        </volist>
                            <tr>
                                <td class="policy_msg">
                                    <p>交强险</p>
                                </td>
                                <td class="policy_money">
                                    <p>&nbsp;</p>
                                </td>
                                <td class="policy_money">
                                    <p>￥{$calc_result['BASE']['N_TRAFF_PRM']}</p>
                               </td>
                                <td class="policy_money">
                                    <p>￥{$calc_result['BASE']['N_TRAFF_REAL_PRM']}</p>
                                </td>
                            </tr>
                            <tr>
                                <td class="policy_msg">
                                    <p>车船税</p>
                                </td>
                                <td class="policy_money">
                                    <p>&nbsp;</p>
                                </td>
                                <td class="policy_money">
                                    <p>￥{$calc_result['BASE']['N_TAX_PRM']}</p>
                               </td>
                                <td class="policy_money">
                                    <p>￥{$calc_result['BASE']['N_TAX_REAL_PRM']}</p>
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="4" class="policy_msg">
                                    保费合计：
                                    {$calc_result['BASE']['N_REAL_PRM']+$calc_result['BASE']['N_TRAFF_REAL_PRM']+$calc_result['BASE']['N_TAX_REAL_PRM']|cny}
                                    &nbsp;&nbsp;<span class="confirm_d_money">￥{$calc_result['BASE']['N_REAL_PRM']+$calc_result['BASE']['N_TRAFF_REAL_PRM']+$calc_result['BASE']['N_TAX_REAL_PRM']}</span>
                                </td>
                            </tr>
                        </tfoot>
                    </table>               
            </div>
         </div>
          <div class="clear">&nbsp;</div>
        <form action="__SELF__" method="post" class="form-horizontal" id="forms">
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">车主姓名：</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" id="c_drv_owner" name="c_drv_owner" placeholder="车主姓名" value="{$c_drv_owner}">
                </div>
            </div>
            <div class="form-group">
                <label for="c_ident_no" class="col-sm-2 control-label">身份证号：</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" id="c_ident_no" name="c_ident_no" placeholder="身份证号" value="{$user.ident_no}">
                </div>
            </div>
            <div class="form-group">
                <label for="mobile" class="col-sm-2 control-label">手机号码：</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" id="mobile" name="mobile" placeholder="手机号码" value="{$user.mobile}">
                </div>
            </div>
            <if condition="is_login()">
            <else/>
            <div class="form-group">
                <label for="mobile" class="col-sm-2 control-label">验证码：</label>
                <div class="col-sm-2">
                  <input type="text" class="form-control" id="verify_code" name="verify" placeholder="验证码">
                </div>
                <div class="col-sm-1">
                  <button type="button" id="get_verify" class="btn btn-warning">获取验证码</button>
                </div>
            </div>
            </if>
        	<div>
        	
        	<div>
                <div class="order_more_tit">
                配送信息
                <div class="f_r clearfix order_add">
                    <span class="order_address"></span>
                    <span class="order_add_word">添加地址</span>
                </div>
            </div>
            <div id="addr_list_div">
                        <table class="table table-hover">
                            <thead>
                                <th>收件地址</th>
                                <th>收件人</th>
                                <th>联系电话</th>
                            </thead>
                            <tbody id="info_addr_list">
                            <volist name="address" id="vo">
                                <tr>
                                <td>
                                    <div class="radio radio-success">
                                        <input type="radio" name="aid" id="add_{$vo.aid}" value="{$vo.aid}" class="styled" <eq name="i" value="1">checked</eq> >
                                        <label for="add_{$vo.aid}">
                                            {$vo.province}{$vo.city}{$vo.area}{$vo.address}
                                        </label>
                                    </div>
                                </td>
                                <td>{$vo.recvname}</td>
                                <td>{$vo.mobile}</td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                    </div>
        	</div>
            <div class="order_more_tit">
             	  选择配送方式
                
                </div>
            <div class="clearfix con_list">
                <div class="span3 f_l t_r">
                    <span>配送方式：</span>
                </div>
                <div class="span7 f_l select_label">
                    <label for="con1" class="on">送货上门</label>
                    <input type="radio" class="hide" id="con1" name="sendtype" value="1" checked="checked" />
                    <label for="con2">营业厅自取</label>
                    <input type="radio" class="hide" id="con2" name="sendtype" value="2" />
                    <span class="help_msg"></span>
                </div>
            </div>
            <div class="clearfix con_list">
                <div class="span3 f_l t_r">
                    <span>支付方式：</span>
                </div>
                <div class="span7 f_l">
                    <select name="c_payment_type"  class="con_list_select" id="select_pay">
                        <option value="01">在线支付</option>
                        <option value="02">上门收款</option>
                    </select>
                    <span class="help_msg"></span>
                </div>
            </div>
            <div class="clearfix con_list" id="select_pay_detail">
                <div class="span7 f_l select_label select_label2">
                    <label for="pay2" class="pay_zhifubao on"></label>
                    <input type="radio" class="hide" id="pay2" checked="checked" value="0" name="test"/>

                    <label for="pay1" class="pay_weixin"></label>
                    <input type="radio" class="hide" id="pay1" value="1" name="test" />
                </div>
            </div>
            <div class="clearfix ins_select_list">
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-3">
                          <button type="button" id="back_btn" class="btn btn-primary btn-block">返回上一步</button>
                        </div>
                        <div class="col-sm-offset-2 col-sm-3">
                          <button type="submit" id="submit_btn" class="btn btn-primary btn-block" data-loading-text="数据递交中..." autocomplete="off">确认付款</button>
                        </div>
                    </div>
            </div>
        </form> 
    </div>
        </div>
    </div>
    <div class="pop_content">
        <div class="new_address">
            <form action="#" method="post" id="formAddr">
                <span class="pop_close"></span>
                <table class="pop_addr_table">
                    <tr>
                        <td class="t_r">省市：</td>
                        <td>
                            <select name="province" id="province" class="required"></select>
                            <select name="city" id="city" class="required"></select>
                            <select name="area" id="area" class="required"></select>
                        </td>
                    </tr>
                    <tr>
                        <td class="t_r">具体地址：</td>
                        <td>
                            <input type="text" name="address" id="address" class="required" size="40" />
                        </td>
                    </tr>
                    <tr>
                        <td class="t_r">联系人：</td>
                        <td>
                            <input type="text" name="recvname" id="recvname" class="required" value="{$user.realname}" />
                        </td>
                    </tr>
                    <tr>
                        <td class="t_r">联系电话：</td>
                        <td>
                            <input type="text" name="mobile" id="mobile" class="required" value="{$user.mobile}" />
                        </td>
                    </tr>
                </table>
                <input type="hidden" name="aid" id="aid" value="" />
                <input type="submit" value="提交" class="add_submit"/>
            </form>
        </div>
    </div>    
    </block>
<block name="script">
<script type="text/javascript" src="__PUBLIC__/Green/js/insurance.js"></script>
<script type="text/javascript" src="__PUBLIC__/Green/js/PCASClass.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jquery.validate.additional.js" charset="UTF-8"></script>
<script type="text/javascript">
 new PCAS("province","city","area");
 
 $('#forms').validate({
    rules:{
        c_ident_no:{
            required:true,
            identno:true
        },
        mobile:{
            required:true,
            mobile:true
        }
    },
    submitHandler:function(form){
        var self = $(form);
        $('#submit_btn').button('loading');
        $.post(self.attr('action'), self.serialize(), function(data){
            if(data.status){
                window.location.href = data.url;
            } else {
                $('#submit_btn').button('reset');
                alert(data.info);
            }
        }, "json");
    }  
 });
 $('#formAddr').validate({
    submitHandler:function(form){
        $.post("{:U('address')}",$(form).serialize(),function(data){
            if(data.status){
                var info = data.info,
                    str = '<tr><td><div class="radio radio-success"><input type="radio" name="aid" id="add_'+info.aid +'" value="'+info.aid
                        +'" class="styled"><label for="add_'+info.aid+'">'+info.province + info.city+info.area+info.address+'</label></div></td><td>'+info.recvname
                        +'</td><td>'+info.mobile+'</td></tr>';
                $(str).appendTo($('#info_addr_list'));
                $('input[name=aid]:radio:last').prop('checked',true);
                $("#formAddr")[0].reset();
                $(".pop_content").hide();
            }else{
                alert(data.info);
            }
        },'json');
    } 
});
 
 var wait_time_g = 60; //60秒内

 function wait_next_g(){
     if(wait_time_g<=0){
         $('#get_verify').attr("disabled", false).text('获取验证码');
         wait_time_g = 60;
     }else{
         wait_time_g --;
         $('#get_verify').attr("disabled", true).text('还有' + wait_time_g + '秒');
         setTimeout('wait_next_g()',1000);
     }
 }

     
     $('#get_verify').click(function(){
         var url = "{:U('User/getVerifyMsg')}",
             mobile = $('#mobile').val();
        $.post(url,{mobile:mobile,forget:0},function(data){
                 if(data.status){
                     wait_next_g();
                 } else {
                     alert(data.info);
                 }
        },"json"); 
     });
 
</script>

</block>
